﻿@model Smarly.Bussines.Model.Account.UpdatePassword

<script type="text/javascript">
	$().ready(function () {
		var $form = $('form.account-update-password');
		$form.smarlyValidation({
			accountUpdatePassUrl: $form.attr('action'),
			onSuccess: function (data) {
				if (data == null || data.redirect == null) {
					var url = window.location.href;
					url = url.replace(/&?repair=([^&]$|[^&]*)/i, "");
					if (url[url.length - 1] == '?')
						url = url.slice(0, -1);
					window.location.replace(url);
				} else {
					window.location = data.redirect;
				}
			}
		});
	});
</script>

@Html.Partial("_AccountRepearDialog", new Smarly.Bussines.Model.Account.RepearPassword())


@using (Html.BeginForm("UpdatePassword", "Account", new { area = "" }, FormMethod.Post, new { @class = "hide account-update-password" }))
{
	<div class="modal-body">
		<p>Вам было выслано письмо с кодом восстановления</p>
		@Html.HiddenFor(x => x.Email)
		@Html.TextBoxFor(x => x.HashCode, new { placeholder = "Код в полученном письме", @class="icon mail-message" })
		@Html.PasswordFor(x => x.Password, new { placeholder = "Пароль", @class="icon" })
		@Html.PasswordFor(x => x.RepeatPassword, new { placeholder = "Еще раз пароль", @class="icon" })
	</div>

	<div class="modal-footer">
		<button class="btn" type="submit"><i class="icon-ok icon-white"></i>&nbsp;Войти</button>
		<button class="btn" data-dismiss="modal"><i class="icon-remove"></i>&nbsp;Отмена</button>
	</div>
}

